local zhenjun = fk.CreateSkill{
  name = "iberia__zhenjun",
}

Fk:loadTranslationTable{
  [zhenjun.name] = "镇军",
  [":"..zhenjun.name] = "出牌阶段限一次，你可以令一名同势力角色将手牌数调整至等于你装备区的牌数。"
}

local I = require "packages/iberia/utility"

zhenjun:addEffect("active", {
  anim_type = "drawcard",
  can_use = function (self, player)
    return player:usedSkillTimes(zhenjun.name, Player.HistoryPhase) < 1
  end,
  card_num = 0,
  target_num = 1,
  card_filter = Util.FalseFunc,
  target_filter = function (self, player, to_select, selected)
    return #selected == 0 and S.isMate(player, to_select)
    and to_select:getHandcardNum() ~= #player:getCardIds("e")
  end,
  on_use = function (self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    if target:getHandcardNum() < #player:getCardIds("e") then
      target:drawCards(#player:getCardIds("e") - target:getHandcardNum())
    else
      room:askToDiscard(target, {
        min_num = target:getHandcardNum() - #player:getCardIds("e"),
        max_num = target:getHandcardNum() - #player:getCardIds("e"),
        skill_name = zhenjun.name,
        cancelable = false,
        include_equip = false,
      })
    end
  end
})

return zhenjun